﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UtilZ.Dotnet.Ex.Communication.Net.Web
{
    /// <summary>
    /// http数据转换器
    /// </summary>
    public interface IHttpDataConverter
    {
        /// <summary>
        /// 尝试读取数据[读取成功返回true;失败返回false]
        /// </summary>
        /// <param name="httpRequest">http请求</param>
        /// <param name="result">读取结果</param>
        /// <returns>读取成功返回true;失败返回false</returns>
        bool TryRead(HttpRequest httpRequest, out object result);

        /// <summary>
        /// 设置http响应
        /// </summary>
        /// <param name="response">http响应</param>
        /// <param name="result">结果数据</param>
        void Write(HttpResponse response, object result);
    }
}
